<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

    <title>Sound — Space.js</title>

    <link rel="preconnect" href="https://fonts.gstatic.com">
    <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto+Mono">
    <link rel="stylesheet" href="assets/css/style.css">

    <script type="module">
        import { BufferLoader, WebAudio } from '../src/index.js';

        const bufferLoader = new BufferLoader();
        await bufferLoader.loadAllAsync(['assets/sounds/gong.mp3']);
        WebAudio.init({ sampleRate: 48000 });
        WebAudio.load(bufferLoader.files);

        const gong = WebAudio.get('gong');
        gong.gain.set(0.5);

        document.addEventListener('pointerdown', () => {
            gong.play();
        });
    </script>
</head>
<body>
</body>
</html>
